#ifndef COREC_QUEUEMANAGER_H
#define COREC_QUEUEMANAGER_H

#include "coreconfigdefs.hpp"
#include "coredataqueue.hpp"
#include "coredataunit.hpp"
#include <string>
#include <map>
#include <boost/thread/thread.hpp>
#include <boost/thread/mutex.hpp>

namespace pland
{

class QueueManager
{
public:
    static QueueManager* Instance();
    void setPort(uint port);
    bool addQueueu(std::string name, SharedDQueue q);
    bool removeQueueu(std::string name);
	void removeAll();
    bool start();
    bool stop();
private:
    QueueManager();
    QueueManager(QueueManager const&);
    QueueManager & operator=(QueueManager const&);
    static QueueManager* instance_;

    std::map <std::string, SharedDQueue > queues_;

    boost::mutex mutex_;
    bool running_;
    boost::thread listener_;
    void start_();
    uint port_;
};

}
#endif // COREC_QUEUEMANAGER_H
